package org.starlight.user.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.starlight.user.entity.Roles;
import org.starlight.user.serivce.RolesService;

/**
 * 角色服务
 *
 * @author huangyong
 * @data 2025/2/28
 */
@Tag(name = "角色服务", description = "角色服务")
@RestController
@RequiredArgsConstructor
@RequestMapping("/role")
public class RolesController {
    private final RolesService rolesService;

    @Operation(summary = "保存角色")
    @ResponseStatus(HttpStatus.OK)
    @PostMapping
    public void saveRole(Roles roles) {
        rolesService.saveRole(roles);
    }

    @Operation(summary = "删除角色")
    @ResponseStatus(HttpStatus.OK)
    @GetMapping("/{id}")
    public void delRole(@PathVariable Integer id) {
        rolesService.delRole(id);
    }

}
